home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Environments / Small Eiffel 0.4.8 / lib_show / cecil / example4 / example.e < prev    next >
Encoding:
Text File  |  1997-04-13  |  832 b   |  42 lines  |  [TEXT/ttxt]

  1. -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C) 
  2. -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
  3. --
  4. class EXAMPLE
  5.    --
  6.    -- The Eiffel program is running first, then call the C program 
  7.    -- which is in charge to add to INTEGER using the infix "+" 
  8.    -- of class INTEGER.
  9.    --
  10.    -- To compile this example, use command :
  11.    --   
  12.    --         compile -cecil cecil.se example c_prog.c
  13.    --
  14.  
  15. creation make
  16.  
  17. feature
  18.  
  19.    make is
  20.       local
  21.      i1, i2, sum: INTEGER;
  22.       do
  23.      i1 := 2;
  24.      i2 := 3;
  25.      io.put_integer(i1);
  26.      io.put_string(" + ");
  27.      io.put_integer(i2);
  28.      io.put_string(" = ");
  29.      sum := call_c_prog(i1,i2);
  30.      io.put_integer(sum);
  31.      io.put_string("%N");
  32.       end;
  33.  
  34. feature {NONE}
  35.  
  36.    call_c_prog(i1, i2: INTEGER): INTEGER is
  37.       external "C"
  38.       alias "c_prog"
  39.       end;
  40.  
  41. end -- EXAMPLE
  42.